// ct = new THREE.CanvasTexture(getTextCanvas('中文'));
// ct.needsUpdate = true;
// ct.canvas

function Canvas(width, height){
    var canvas = document.createElement('canvas');
    canvas.width = width;
    canvas.height = height;
    return canvas;
}

function clean(canvas){
    var ctx = canvas.getContext('2d');
    ctx.fillStyle = '#00000000';
    ctx.fillRect(0, 0, canvas.width, canvas.height);
}

function text(canvas, txt, x, y){
    var ctx = canvas.getContext('2d');
    
    ctx.font = 'bold 20px 黑体';
    ctx.fillStyle = '#FFFFFFFF';
    ctx.textAlign = 'center';
    ctx.textBaseline = 'middle';
    ctx.fillText(txt, x+1, y+1); 

    ctx.fillStyle = '#000000FF';
    ctx.fillText(txt, x, y); 
}

export default { Canvas, clean, text };